var layerId;
var clickState=true;
$(function(){
	$("#save-button").click(function(){
		var showMethod = $("select[name='showMethod']").val();
		var title = $("input[name='title']").val();
		var url = $("input[name='url']").val();
		var orderNo = $("input[name='orderNo']").val();
		var image = $("#imageUrl").attr("data-img");
		if(showMethod.length == 0){
			layer.msg("请选择展示页");
			return false;
		}
		if(title.length == 0){
			layer.msg("请输入标题");
			return false;
		}
		if(!isNum(orderNo)){
			layer.msg("排序顺序——请输入正整数");
			return false;
		}
		if(image.length == 0){
			layer.msg("请上传封面图");
			return false;
		}
		var bannerId=init.bannerId;
		var banner ={
			"id":bannerId,
			"title":title,
			"showMethod":showMethod,
			"orderNo":orderNo,
			"imageUrl":image,
			"url":url,
			"type":1,
			"dataId":0,
		}
		if(clickState){
			clickState=false;
			$.ajax({
				url:basePath+"/banner/save.shtml",
				data:banner,
				type:"post",
				dataType:"JSON",
				success:ajaxSuccessCloseFun
			});
		}
	});
	$("#close-button").click(function(){
		parent.closeLayer(0);
	});
	
});